/*
 * @Author: szx
 * @Date: 2022-03-03 14:12:49
 * @LastEditTime: 2022-03-03 14:14:16
 * @Description:
 * @FilePath: \leetcode\200-299\222\222_2.js
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
var countNodes = function (root) {
    if (!root) return 0;
    const left = countNodes(root.left);
    const right = countNodes(root.right);
    return 1 + left + right;
};
